//
//  NewSongCollectionViewCell.m
//  212--Homework  QQy音乐  阿里星球
//
//  Created by 冀永金 on 16/8/13.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "NewSongCollectionViewCell.h"
#import "UIImageView+WebCache.h"
#import "ThirdModel.h"
@interface NewSongCollectionViewCell ()
@property (nonatomic, strong) UIImageView *image;
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UILabel *descLabel;
@end

@implementation NewSongCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.image = [[UIImageView alloc]init];
        [self.contentView addSubview:_image];
        //_image.backgroundColor = [UIColor yellowColor];
        self.nameLabel = [[UILabel alloc]init];
        _nameLabel.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_nameLabel];
        //_nameLabel.backgroundColor = [UIColor blueColor];
        _descLabel = [[UILabel alloc]init];
        _descLabel.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_descLabel];
       // _descLabel.backgroundColor = [UIColor cyanColor];
        
    }
    return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.image.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.width);
    self.nameLabel.frame = CGRectMake(0, self.bounds.size.width + 5, self.bounds.size.width, 30);
    self.descLabel.frame = CGRectMake(0, self.bounds.size.width + 40, self.bounds.size.width, 20);
}
- (void)setThird:(ThirdModel *)third {
    _third = third;
    [self.image sd_setImageWithURL:[NSURL URLWithString:third.picUrl] placeholderImage:[UIImage new]];
    self.nameLabel.text = third.name;
    self.descLabel.text = third.desc;
}
@end
